"use strict"

/**
 * 浙江省国家税务局采购网爬虫
 *  postt请求
 */

var Base = require("./base");
var zj_spider = new Base();
zj_spider.name = "浙江省国家税务局采购网";
zj_spider.page = 5;
zj_spider.encode = "gbk";

zj_spider.getPageUrl = function (pg) {
    if (pg == 1) {
        return "http://www.zjtax.gov.cn/pub/13300000000/08/";
    }
    else {
        return "http://www.zjtax.gov.cn/pub/13300000000/08/index_" + (pg - 1) + ".html";
    }
};

zj_spider.getItems = function ($) {
    var items = [];
    //$($("div.onelist.newslist ul li a")[0]).text()
    var jqObj = $(".gs_gl3_sp5>a");
    var td_length = jqObj.length;
    for (var i = 0; i < td_length; i++) {
        var item = {};
        item.title = $(jqObj[i]).text();
        item.url = $(jqObj[i]).attr("href");
        item.source = zj_spider.name;
        items.push(item);
    }
    return items;
};

exports = module.exports = zj_spider;